class Solution(object):
    def reverseParentheses(self, s):
        st = [[]]
        for c in s:
            if c == '(':
                st.append([])
            else:
                if c == ')':
                    node = st.pop()
                    if node:
                        st[-1].append(''.join(node)[::-1])
                else:
                    st[-1].append(c)
        return ''.join(st[0])

